package com.qfedu.mes2admin.sys.controller;

import com.qfedu.annotation.NoLoginCheck;
import com.qfedu.common.R;
import com.qfedu.mes2admin.sys.params.LoginParam;
import com.qfedu.mes2admin.sys.service.LoginService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/app/admin")
public class LoginController {

    @Resource
    private LoginService loginService;

    /**
     * 登录
     * @param param
     * @return
     */
    @NoLoginCheck//登录接口不需要登录的权限判断
    @PostMapping("/login")
    public R login(@RequestBody LoginParam param){
        String token = loginService.login(param);
        return R.ok(token);
    }
}
